package com.dyh.quickdemozwei.Mth;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author: yhdong
 * @Date: 2021/12/3 14:56
 */
@Slf4j
@Setter@Getter
public class Mth {
    MonitorThread monitorThread;
    String code;
    public void start(){
        this.monitorThread = new MonitorThread();
        this.monitorThread.setCode(code+"!");
        this.monitorThread.start();
    }

    @Setter@Getter
    public class MonitorThread extends Thread{

        String code;

        @Override
        public void run() {
            synchronized (this){
                for (;;){
                    try {
                        wait(200L);
                        log.info("hello {}",this.code);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }

            }
        }
    }
}
